package org.mentalsmash.tazio.evaluation.mock;

import java.util.Random;

import org.mentalsmash.tazio.transactions.PropertyGetter;
import org.mentalsmash.tazio.transactions.PropertySetter;
import org.mentalsmash.tazio.transactions.RollbackException;

public class MediumCounterImpl implements MediumCounter {

    private static final long serialVersionUID = -8685990433480713607L;

    // each elements adds ~8 Bytes
    private final static int NUM_PAYLOAD_ELEMS = (int) Math.pow(2, 16);

    private int counterValue = 0;

    private String arrayToSend;

    public MediumCounterImpl() {
	Random rand = new Random();

	StringBuilder b = new StringBuilder();
	for(int i=0; i<NUM_PAYLOAD_ELEMS; i++) {
	    b.append(rand.nextInt(10)+"");
	}
	arrayToSend = b.toString();
    }

    public int getValue() throws RollbackException {
	return this.counterValue;
    }

    public void setValue(int newValue) throws RollbackException {
	this.counterValue = newValue;
    }

    public String getString() throws RollbackException {
	return this.arrayToSend;
    }

    public void setString(String val) throws RollbackException {
	this.arrayToSend = val;
	
    }

    

}
